﻿<UserControl x:Class="Chapters.Chapter10.RuntimeSkinning"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
	<UserControl.Resources>
		<DataTemplate x:Key="GroupBoxHeaderTemplate">
			<TextBlock FontWeight="Bold"
					   Text="{Binding}" />
		</DataTemplate>

		<Style TargetType="Label"
			   x:Key="LabelSkin">
			<Setter Property="DockPanel.Dock"
					Value="Left" />
			<Setter Property="Width"
					Value="100" />
		</Style>

		<Style TargetType="Button"
			   x:Key="ButtonSkin">
			<Setter Property="HorizontalAlignment"
					Value="Right" />
		</Style>
	</UserControl.Resources>
	<DockPanel>
		<GroupBox Header="Choose a Skin"
				  HeaderTemplate="{StaticResource GroupBoxHeaderTemplate}"
				  DockPanel.Dock="Left"
				  Padding="8"
				  Height="140"
				  Margin="8"
				  Background="LightGoldenrodYellow">
			<UniformGrid Columns="1"
						 x:Name="_skinChanger">
				<RadioButton x:Name="None"
							 Content="No Skin"
							 IsChecked="True" />
				<RadioButton x:Name="BlueSkin"
							 Content="Blue Skin" />
				<RadioButton x:Name="RedSkin"
							 Content="Red Skin" />
				<RadioButton x:Name="GreenSkin"
							 Content="Green Skin" />
			</UniformGrid>
			<GroupBox.Effect>
				<DropShadowEffect Opacity="0.25" />
			</GroupBox.Effect>
		</GroupBox>

		<Grid x:Name="_contactForm">
			<Border Style="{DynamicResource FormSkin}"
					Width="400"
					Height="300">
				<Grid>
					<Grid.RowDefinitions>
						<RowDefinition Height="*" />
						<RowDefinition Height="*" />
						<RowDefinition Height="*" />
						<RowDefinition Height="4*" />
						<RowDefinition Height="*" />
					</Grid.RowDefinitions>

					<DockPanel Grid.Row="0"
							   Margin="0,0,0,8">
						<Label Content="Name"
							   Style="{DynamicResource LabelSkin}" />
						<TextBox  Style="{DynamicResource TextBoxSkin}" />
					</DockPanel>
					<DockPanel Grid.Row="1"
							   Margin="0,0,0,8">
						<Label Content="Email"
							   Style="{DynamicResource LabelSkin}" />
						<TextBox Style="{DynamicResource TextBoxSkin}" />
					</DockPanel>
					<DockPanel Grid.Row="2"
							   Margin="0,0,0,8">
						<Label Content="Website"
							   Style="{DynamicResource LabelSkin}" />
						<TextBox  Style="{DynamicResource TextBoxSkin}" />
					</DockPanel>
					<DockPanel Grid.Row="3"
							   Margin="0,0,0,8">
						<Label Content="Message"
							   Style="{DynamicResource LabelSkin}" />
						<TextBox TextWrapping="Wrap"
								 AcceptsReturn="True"
								 Style="{DynamicResource TextBoxSkin}" />
					</DockPanel>
					<Button Content="Submit"
							Grid.Row="4"
							Width="100"
							Style="{DynamicResource ButtonSkin}" />
				</Grid>
			</Border>
		</Grid>
	</DockPanel>
</UserControl>
